﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Automobile.service.BLL;
using Automobile.service.Common;
using Automobile.service.Model;
namespace Automobile.service.UI
{
    public partial class Supplier_Add : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            SupplierBLL bll = new SupplierBLL();
            Supplier s = new Supplier();
            s.Supplier_Name = this.Supplier_Name.Value;
            s.Supplier_People = this.Supplier_People.Value;
            s.Supplier_Phone = this.Supplier_Phone.Value;
            s.Supplier_Addr = this.Supplier_Addr.Value;
            if (bll.AddSupplier(s) > 0)
            {
                JournalBLL jbll = new JournalBLL();
                jbll.AddJourna_AddSupplier(Convert.ToInt32(Session["empid"]),s);
                Response.Write("<script>alert('添加成功！');parent.location.reload(); parent.layer.close(parent.layer.getFrameIndex(window.name));</script>");

            }
            else
            {
                Response.Write("<script>alert('添加失败！');parent.layer.close(parent.layer.getFrameIndex(window.name));</script>");
            }
        }
        
    }
}